package com.itheima.pojo;



import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class User {

    @NotNull(message = "用户id不能为空")
    private Integer id;//主键ID

    private String username;//用户名

    @JsonIgnore //springMVC在返回json时忽略该字段
    private String password;//密码

//    @NotNull(message = "昵称不能为空")
    @NotEmpty(message = "昵称不能为空")
    @Pattern(regexp = "^\\S{1,10}$",message = "昵称长度为1-10位")
    private String nickname;//昵称

    @NotEmpty(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;//邮箱

    private String userPic;//用户头像地址

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;//创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime updateTime;//更新时间
}
